package servlet;

import dao.ProductDAO;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

@WebServlet(name="productstatus",value = "/product/status")
public class ProductStatusServlet extends HttpServlet {

    @Override
    protected void service(HttpServletRequest req, HttpServletResponse resp)throws ServletException, IOException {
        //获取post请求参数乱码问题
        req.setCharacterEncoding("UTF-8");
        String id=req.getParameter("id");

        ProductDAO productDAO=new ProductDAO();
        productDAO.updateStatus(id);

        req.getRequestDispatcher( "/product/list").forward(req,resp);

    }

}
